package edu.wayne.cs.csc4110.hw6.framework;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JComponent;

import edu.wayne.cs.csc4110.hw6.framework.plugin.ActivePlugin;

public class GameScreen extends JComponent implements ComponentListener {

	private ActivePlugin plugin;

	public GameScreen(ActivePlugin p) {
		if (p.getCursor() != null) {
			this.setCursor(p.getCursor());
		}

		this.setPreferredSize(new Dimension(p.getWidth(), p.getHeight()));
		plugin = p;
		addMouseListener(plugin);
		addMouseMotionListener(plugin);
		addKeyListener(plugin);
		requestFocus();
		addComponentListener(this);

	}

	@Override
	public void paintComponent(Graphics gfx) {
		plugin.draw(gfx);
	}

	@Override
	public void componentResized(ComponentEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void componentMoved(ComponentEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void componentShown(ComponentEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void componentHidden(ComponentEvent e) {
		// TODO Auto-generated method stub

	}

}
